import 'package:flutter/material.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
import 'package:xiongan_app_yy/widgets/notification/time_notification.dart';

class IconTextCardWidget extends StatefulWidget {
  final String title;
  final EdgeInsets margin;
  Border border;
  VoidCallback onPressed;
  bool visibility;
  String iconImage;
  IconTextCardWidget(
      {@required this.title,
      this.margin,
      this.border,
      @required this.onPressed,
      this.visibility,this.iconImage});

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return IconTextCardWidgetState();
  }
}

class IconTextCardWidgetState extends State<IconTextCardWidget> {
  @override
  Widget build(BuildContext context) {
    if (widget.border == null) {
      widget.border =
          Border(bottom: BorderSide(width: 1, color: Color(0xffdddddd)));
    }
    if (widget.visibility == null) {
      widget.visibility = false;
    }
    return GestureDetector(
        child: Container(
          width: double.infinity,
          margin: widget.margin,
          padding: EdgeInsets.only(left: 16, right: 16),
          decoration: BoxDecoration(color: Colors.white, border: widget.border),
          child: Row(
            children: <Widget>[
              Container(
                height: 30,
                width: 30,
                child:Image.asset(widget.iconImage,fit: BoxFit.fill,)
              ),
              Container(
                child: Text(widget.title, style: TextStyle(fontSize: 16)),
                padding: EdgeInsets.only(top: 15, bottom: 15,left: 5),
              ),
              Expanded(
                  child: Offstage(
                offstage: widget.visibility,
                child: Column(
                    crossAxisAlignment: CrossAxisAlignment.end,
                    children: <Widget>[
                      Container(
                        child: Image.asset("assets/images/arrow.png",
                            fit: BoxFit.fill),
                        width: 8,
                        height: 13,
                      ),
                    ]),
              ))
            ],
          ),
        ),
        onTap: () {
          widget.onPressed();
        });
  }
}
